/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package datas;

import beans.User;
import java.math.BigDecimal;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author havn
 */
public class UserObj {

    private connector con;

    public UserObj() {
        this.con = new connector();
    }

    public boolean payment(User u, int money) {
        try {
            CallableStatement call = con.getCon().prepareCall("{call Payment(?,?,?,?)}");
            call.setString(1, u.getCardnumber());
            call.setString(2, u.getPass());
            call.setString(3, u.getName());
            call.setInt(4, money);
            int rs = call.executeUpdate();
            if(rs > 0){
                return true;
            }else{
                return false;
            }
        } catch (SQLException ex) {
            Logger.getLogger(UserObj.class.getName()).log(Level.SEVERE, null, ex);
        }
        return false;
    }
}
